package class22;

/**
 * @author zhangchaoliang
 * create 2022
 */
public class MSumToN {

    public static boolean isMSum1(int num){
        for (int start = 1;start <= num;start++){
            int sum = start;
            for (int j = start+1;j<=num;j++){
                if (sum + j > num){
                    break;
                }
                if (sum + j == num)
                    return true;
                sum += j;
            }
        }
        return false;
    }

    public static boolean isMSum2(int num){
        if (num<3){
            return false;
        }
        return (num & (num -1)) != 0;
    }

    public static void main(String[] args) {
        for (int num=1;num<200;num++){
            System.out.println(num+" : "+isMSum1(num));
        }
    }
}
